//
//  UIButton+Extension.swift
//  weibo_swift
//
//  Created by 紫荆秋雪 on 16/12/16.
//  Copyright © 2016年 紫荆秋雪. All rights reserved.
//

import UIKit
extension UIButton {
    convenience init(textNormal: String, textSelect: String, textSize: CGFloat = 15, textNormalColor: UIColor, textHightColor: UIColor, imageNormalName: String, imageHightName: String, backgroundImageName: String) {
        self.init()
        titleLabel?.font = UIFont.systemFont(ofSize: textSize)
        setTitle(textNormal, for: .normal)
        setTitleColor(textNormalColor, for: .normal)
        setTitle(textSelect, for: .selected)
        setTitleColor(textHightColor, for: .highlighted)
        setImage(UIImage(named: imageNormalName), for: .normal)
        setImage(UIImage(named: imageHightName), for: .highlighted)
        setBackgroundImage(UIImage(named: backgroundImageName), for: .normal)
        titleLabel?.textAlignment = .center
    }
    
    convenience init(buttonText: String, textSelect: String, textSize: CGFloat = 15, textNormalColor: UIColor, textHightColor: UIColor, imageNormalName: String, imageSelectedName: String, backgroundImageName: String) {
        self.init()
        titleLabel?.font = UIFont.systemFont(ofSize: textSize)
        setTitle(buttonText, for: .normal)
        setTitleColor(textNormalColor, for: .normal)
        setTitle(textSelect, for: .selected)
        setTitleColor(textHightColor, for: .highlighted)
        setImage(UIImage(named: imageNormalName), for: .normal)
        setImage(UIImage(named: imageSelectedName), for: .selected)
        setBackgroundImage(UIImage(named: backgroundImageName), for: .normal)
    }
}
